class PasswordGenerator
  LENGTH = 6
  CHAR_GETTERS = [:get_random_letter, :get_random_num]

	def self.generate
		(1..LENGTH).inject("") {|str, char| str + get_char}
	end
  
  private 
	def self.rand_int_between(a_, b_)
		arr = [a_, b_]
		a = arr.min.ceil
		b = arr.max.floor
		a + rand(b - a + 1)
	end

	def self.get_random_letter
		rand_int_between(97, 122).chr
	end
	
	def self.get_random_num
		rand_int_between(0, 9).to_s
	end

	def self.get_char
		send(CHAR_GETTERS[rand(2)])
	end
end